export { };

// 函数
const add = (...params: number[]) => {
	return params.reduce((p, n) => {
		return p + n
	}, 0)
}


const s1 = add(1, 2, 3, 4, 5)
const s2 = add(11, 22, 33, 44, 55)
// console.log(s1, s2);
// 函数
function format(param: number | string): number {
	if (typeof param === 'number') return param
	return param.length
}

const s3 = format(6)
const s4 = format('1,2,3,4,5,6,7,8,9')

// console.log(s3, s4);

// 类
class Person {
	protected name: string
	private age: number
	public constructor(name: string, age: number) {
		this.name = name
		this.age = age
	}

	public say() {
		console.log(`我是${this.name}, 今年${this.age}岁了！！！`)
	}
}


class Son extends Person {
	public money: number = 10000
	public constructor(name: string, age: number) {
		super(name, age);
		console.log(123);
	}
}


const p1 = new Person('张三', 18)
const p2 = new Person('李四', 20)
const p3 = new Son('儿子', 10)





